<!DOCTYPE html>
<html>
    <head>
        <title>XSLTProcessor Example</title>   
        <script type="text/javascript">
            
            window.onload = function () {
                //use XHR to load
                var xmlhttp = new XMLHttpRequest();
                xmlhttp.open("get", "employees.xml", false);
                xmlhttp.send(null);
                var xmldom = xmlhttp.responseXML;
                
                xmlhttp = new XMLHttpRequest();
                xmlhttp.open("get", "employees4.xslt", false);
                xmlhttp.send(null);
                var xsltdom = xmlhttp.responseXML; 

                var processor = new XSLTProcessor();
                processor.importStylesheet(xsltdom);

                var fragment = processor.transformToFragment(xmldom, document);
                var text = fragment.firstChild.nodeValue;
                alert(text);

            }
        </script>           
    </head>
    <body>
        <p>This example loads employees.xml and transforms it using employees4.xslt. 
        The XSLT should print out only text without XML code, which is displayed
        in an alert.</p>
        <div id="divResult"></div>
    </body>
</html>
